import 'package:json_annotation/json_annotation.dart';

part 'account_detail.g.dart';

@JsonSerializable()
class AccountDetail {
  final String selectedTimeQuery;
  final String selectedTotalItem;
  final Map<String, dynamic> timeQueryItems;
  final Map<String, dynamic> accountTotalItems;
  final List<StatisticsItem> statisticsItems;
  final List<ChangeLogItem> changeLogVos;

  AccountDetail(
    this.selectedTimeQuery,
    this.selectedTotalItem,
    this.timeQueryItems,
    this.accountTotalItems,
    this.statisticsItems,
    this.changeLogVos,
  );

  factory AccountDetail.fromJson(Map<String, dynamic> json) => _$AccountDetailFromJson(json);

  Map<String, dynamic> toJson() => _$AccountDetailToJson(this);
}

@JsonSerializable()
class StatisticsItem {
  final String itemName;
  final String income;
  final String outcome;

  StatisticsItem(
    this.itemName,
    this.income,
    this.outcome,
  );

  factory StatisticsItem.fromJson(Map<String, dynamic> json) => _$StatisticsItemFromJson(json);

  Map<String, dynamic> toJson() => _$StatisticsItemToJson(this);
}

@JsonSerializable()
class ChangeLogItem {
  final int id;
  final String accountTypeName;
  final String amount;
  final String balanceAfterChanged;
  final String notArrivedAmount;
  final String notArrivedBalanceAfterChanged;
  final String operationTypeName;
  final String changeOrigin;
  final String description;
  final bool changeEnd;
  final String changeTime;
  final String createTime;

  ChangeLogItem(
    this.id,
    this.accountTypeName,
    this.amount,
    this.balanceAfterChanged,
    this.notArrivedAmount,
    this.notArrivedBalanceAfterChanged,
    this.operationTypeName,
    this.changeOrigin,
    this.description,
    this.changeEnd,
    this.changeTime,
    this.createTime,
  );

  factory ChangeLogItem.fromJson(Map<String, dynamic> json) => _$ChangeLogItemFromJson(json);

  Map<String, dynamic> toJson() => _$ChangeLogItemToJson(this);
}
